<template>
	<view>
		<zmm-watermark :watermark="userStore.watermark" v-if="userStore.watermark"></zmm-watermark>
		<view class="content detail">
			<!--商品信息-->
			<view class="detail-item">
				<uni-section title="商品信息" type="line"></uni-section>
				<view class="detail-content">
					<view class="detail-text">供应商：<text>{{info.supplierName}}</text></view>
					<view class="detail-text">
						区域：
						<uni-tag size="small" :text="arrText(setStore.allProvinceList, info.regionCode)" />
					</view>
					<view class="detail-text">商品名称：<text>{{info.productName}}</text></view>
					<view class="detail-text">商品类型：<text>{{info.typeName}}</text></view>
					<view class="detail-text">商品单位：<text>{{info.unit}}</text></view>
					<view class="detail-text">规格标志：<uni-tag size="small" type="success" :text="info.moreSpec === 0 ? '单规格' : '多规格'" /></view>
					<view class="detail-text" v-if="checkPermi(['zhouyz:purchaseOrder:price'])">采购价格：<text>{{info.purchasePrice}}</text></view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { computed, onMounted, ref } from 'vue'
import { tab, auth, modal } from "@/plugins"
import { getTitle } from "@/utils/getter"
import { checkPermi, checkRole, checkOnlyPermi, checkOnlyRole } from "@/utils/permission"
import { supplierProductDetail } from "@/api/erp_api/purchase"
import { allProvince } from "@/api/erp_api/region"
import { copyText, arrText } from '@/utils/ty.js';
import useUserStore from '@/store/modules/user'
import useSetStore from '@/store/modules/set'

	const userStore = useUserStore()
	const setStore = useSetStore()
	onLoad(async (option) => {
		if (option.id) {
			id.value = option.id
			getDetail()
		}
	})
	
	// 数据查询
	const id = ref('')
	const info = ref({})
	const isLoading = ref(false)
	
	const getDetail = () => {
		const params = {
			id: id.value
		}
		isLoading.value = true
		uni.showLoading({
			title: '数据加载中...'
		})
		supplierProductDetail(params).then(res => {
			info.value = res.data || {}
			isLoading.value = false
			uni.hideLoading()
    }).catch(() => {
			isLoading.value = false
			uni.hideLoading()
		})
	}
	
</script>

<style scoped lang="scss">
.detail-text-integral {
	margin-left: 20rpx;
}
.detail-text-banners {
	margin-left: -10rpx;
}
.detail-text-banner {
	margin: 0 10rpx 10rpx;
}
.detail-text-video {
	width: 100%;
	height: 250rpx;
}
</style>
